# -*- coding;utf-8 -*-
"""
File name : Randnumbers.PY
Program IDE : PyCharm
Create file time: 2023/3/9 8:19
File Create By Author : 朱清闯
"""
import random


def generate_random_code(code_type=1, code_len=4):
    """
    :param code_type:产生的类型，1为数字大小写字母，2为阿拉伯数字，默认为1
    :param code_len:编码的长度，默认为4
    :return:
    """
    all_chars = ''
    code = ""
    if code_type == 1:
        all_chars = '3456789abcdefghijklmnopqrstuvwsyABCDEFGHJKLMNOPQRSTUVWXY'
    elif code_type == 2:
        all_chars = '0123456789'
    elif code_type == 3:
        all_chars = '3456789ABCDEFGHJKLMNPQRSTUVWXY'
    code = code.join(random.choices(all_chars, k=code_len))
    return code

